#include QMK_KEYBOARD_H

enum layer_names {
    _MAIN,
    _FN1,
    _FN2,
    _FN3
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [_MAIN] = LAYOUT(
     KC_ESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_GRV,
     KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSLS,
     KC_LCTL, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,
     KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_BSPC,
     MO(2),   MO(3), KC_LGUI, KC_LALT, LT(1,KC_ENT),KC_NO, KC_SPC,KC_NO, LT(1,KC_RALT), LT(2,KC_RCTL), KC_APP, TO(2)
  ),

  [_FN1] = LAYOUT(
     _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,
     _______, KC_LCBR, KC_PGUP, KC_UP,   KC_HOME, KC_RCBR, KC_NO,   KC_HOME, KC_PGUP, KC_NO,   KC_NO,   KC_F12, 
     _______, KC_LPRN, KC_LEFT, KC_DOWN, KC_RGHT, KC_RPRN, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_MINS, KC_EQL,
     _______, KC_LBRC, KC_END,  KC_NO,   KC_PGDN, KC_RBRC, KC_NO,   KC_PGDN, KC_END,  KC_ENT,  KC_INS,  KC_DEL,
     _______, _______, _______, _______, _______, _______, KC_BSPC, _______, _______, _______, _______, _______
  ),

  [_FN2] = LAYOUT(
     TO(0),   KC_1,    KC_2,    KC_SLCK, KC_PAUS, KC_PSCR, KC_CALC, KC_ESC,  KC_PMNS, KC_PERC, KC_PSLS, MO(3), 
     _______, KC_NO,   KC_WH_U, KC_MS_U, KC_NO,   KC_NO,   KC_F2,   KC_7,    KC_8,    KC_9,    KC_PAST, KC_NO, 
     _______, KC_NO,   KC_MS_L, KC_MS_D, KC_MS_R, KC_NO,   KC_ENT,  KC_4,    KC_5,    KC_6,    KC_MINS, KC_EQL,
     _______, KC_NO,   KC_NO,   KC_NO,   KC_WH_D, KC_NO,   KC_NO,   KC_1,    KC_2,    KC_3,    KC_PPLS, KC_BSPC,
     _______, _______, _______, KC_BTN2, KC_BTN1, _______, KC_0,    _______, KC_PDOT, _______, _______, TO(0)
  ),

  [_FN3] = LAYOUT(
     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,   _______,
     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
     _______, KC_MPRV, KC_MRWD, KC_MFFD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______,
     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
     _______, _______, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______, _______, _______, _______, _______
  )
};